# encoding:utf8
''' 2017-8-24 pylint fix '''
import os
import sys
import json
import shutil
import logging
import plistlib

class GitHelper(object):

    def __init__(self, user, pwd):
        self._user = user 
        self._pwd = pwd

    def git_add(self, tarpath_):
        os.chdir(tarpath_)
        cmd_str = "git add -A --username"
        os.system(cmd_str)

    def git_push(self, tarpath, svnlog="AUTO:Jenkins tools commit", singlefile=""):
        os.chdir(tarpath)
        cmd_commit = '''git commit -m "{svnlog}" {singlefile}'''.format(svnlog=svnlog, singlefile=singlefile)
        cmd_push = '''git push origin develop'''
        os.system(cmd_commit)
        os.system(cmd_push)

    def git_pull(self, tarpath_):
        os.chdir(tarpath_)
        cmd_update = '''git pull origin develop'''
        os.system(cmd_update)